﻿namespace Komunikator
{
    using System.Windows.Controls;
    using System.Windows.Navigation;
    using Komunikator.Controls;
    using Komunikator.Views;
    /// <summary>
    /// Home page for the application.
    /// </summary>
    public partial class Home : Page
    {
        /// <summary>
        /// Creates a new <see cref="Home"/> instance.
        /// </summary>
        /// 
        
        public Home()
        {
            InitializeComponent();

            if (WebContext.Current.User.IsAuthenticated)
            {
                ContactListControl conlist = new ContactListControl();
                conlist.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
                conlist.Margin = new System.Windows.Thickness(40, 100, 15, 200);
                this.ContentStackPanel.Children.Add(conlist);
            }

            this.Title = ApplicationStrings.HomePageTitle;


        }

        /// <summary>
        /// Executes when the user navigates to this page.
        /// </summary>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {

        }

        private void button1_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            ChatWindow fw = new ChatWindow();
            fw.Title = "Rozmowa z ...";
            fw.Width = 400;
            fw.Height = 400;
            //fw.Content = "Tutaj bedzie jakis tekst";
            fw.ParentLayoutRoot = this.LayoutCanvas;
            fw.Show();
            //this.LayoutRoot.Children.Add(fw);
        }
    }
}